package org.jeecg.modules.agentsflex.utils;

import com.agentsflex.core.functions.annotation.FunctionDef;
import com.agentsflex.core.functions.annotation.FunctionParam;
import com.agentsflex.core.llm.Llm;
import com.agentsflex.core.llm.response.FunctionMessageResponse;
import com.agentsflex.core.prompt.FunctionPrompt;
import com.agentsflex.llm.qwen.QwenLlm;
import com.agentsflex.llm.qwen.QwenLlmConfig;

public class WeatherFunctions {

    @FunctionDef(name = "get_the_weather_info", description = "get the weather info")
    public static String getWeatherInfo(
        @FunctionParam(name = "city", description = "the city name") String name
    ) {
        return "Today it will be dull and overcast in " + name;
    }

    public static void main(String[] args) {
        QwenLlmConfig config = new QwenLlmConfig();
        config.setApiKey("sk-f0705***************");
        config.setModel("qwen-turbo");

        Llm llm = new QwenLlm(config);
            FunctionPrompt prompt = new FunctionPrompt("北京天气怎么样", WeatherFunctions.class);
            FunctionMessageResponse response = llm.chat(prompt);
            Object result = response.getFunctionResult();
        System.out.printf("result: %s\n", result);
    }
}
